<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>为指定书名添加颜色</title>
<style>
body{
font-family:微软雅黑}
.search input{
width:350px;
height:30px;}
.item{
width:350px;
height:100px;
line-height:100px;
border-bottom:1px solid #999999;}
.item img{
width:100px;
float:left}
.active{
height:100px;
line-height:100px;
color:#FF0000
}
</style>
<script src="../JS/vue.js"></script>
</head>
<body>
<div id="example">
	<div>
		<div class="item" v-for="book in books">
			<img v-bind:src="book.image">
			<span v-bind:class="{active : book.active}">{{book.bookname}}</span>
		</div>
	</div>
</div>
<script type="text/javascript">
var vm = new Vue({
	el:'#example',
	data:{
		books : [{//定义图书信息数组
			bookname : '零基础学JavaScript',
			image : 'images/javascript.png',
			active : true
		},{
			bookname : '零基础学HTML5+CSS3',
			image : 'images/htmlcss.png',
			active : false
		},{
			bookname : 'JavaScript精彩编程200例',
			image : 'images/javascript200.png',
			active : false
		},{
			bookname : 'HTML5+CSS3精彩编程200例',
			image : 'images/htmlcss200.png',
			active : true
		}]
	}
})
</script>


</body>

</html>



